package network.udp;

import java.io.IOException;
import java.net.SocketException;

import java.util.HashMap;
import java.util.Map;

public class DictServer extends EchoServer{
    private Map<String ,String> dict=new HashMap<>();


    public DictServer(int port) throws SocketException {
        super(port);
        dict.put("cat","小猫");
        dict.put("dog","小狗");
        dict.put("mouse","老鼠");
        dict.put("snake","蛇");
        dict.put("tiger","老虎");
        dict.put("elephant","大象");
        dict.put("monkey","猴子");
        dict.put("rabbit","兔子");
        dict.put("horse","马");
        dict.put("goat","山羊");
        dict.put("cow","奶牛");
        dict.put("sheep","羊");
        dict.put("fish","鱼");
        dict.put("duck","鸭");
        dict.put("pig","猪");
        dict.put("chicken","鸡");


    }
    @Override
    public String process(String request){
        return dict.getOrDefault(request,"没有这个单词");
    }
    public static void main(String[] args) throws IOException {
        
        DictServer server=new DictServer(9000);
        server.start();
    }


}
